<nz-spin [nzSpinning]="isBusy">
    <form nz-form [formGroup]="formGroup">
        <nz-form-item>
            <nz-form-label [nzSpan]="4">新密码</nz-form-label>
            <nz-form-control [nzSpan]="20" [nzErrorTip]="newPasswordError">
                <input nz-input type="password" formControlName="newPassword" [(ngModel)]="newPassword"/>
                <ng-template #newPasswordError let-control>
                    <ng-container *ngIf="control.hasError('required')">
                        新密码不可为空！
                    </ng-container>
                    <ng-container *ngIf="control.hasError('minlength')">
                        密码长度不可小于6！
                    </ng-container>
                    <ng-container *ngIf="control.hasError('maxlength')">
                        密码长度不可大于20！
                    </ng-container>
                </ng-template>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="4">确认密码</nz-form-label>
            <nz-form-control [nzSpan]="20" [nzErrorTip]="confirmedPasswordError">
                <input nz-input type="password" formControlName="confirmedPassword" [(ngModel)]="confirmedPassword"/>
                <ng-template #confirmedPasswordError let-control>
                    <ng-container *ngIf="control.hasError('required')">
                        确认密码不可为空！
                    </ng-container>
                    <ng-container *ngIf="control.hasError('minlength')">
                        密码长度不可小于6！
                    </ng-container>
                    <ng-container *ngIf="control.hasError('maxlength')">
                        密码长度不可大于20！
                    </ng-container>
                </ng-template>
            </nz-form-control>
        </nz-form-item>
    </form>
</nz-spin>
<div class="form-footer">
    <nz-space>
        <button type="submit" nz-button *nzSpaceItem nzType="primary" [nzLoading]="isBusy" (click)="submit()">
            确定
        </button>
        <button type="button" nz-button *nzSpaceItem (click)="cancel()">
            取消
        </button>
    </nz-space>
</div>
